
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>函数式编程 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="面向对象编程.html" />
    
    
    <link rel="prev" href="函数.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="基础.html">
            
                <a href="基础.html">
            
                    
                    基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="字符串处理.html">
            
                <a href="字符串处理.html">
            
                    
                    字符串处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="数据结构.html">
            
                <a href="数据结构.html">
            
                    
                    数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="数据结构高级内容.html">
            
                <a href="数据结构高级内容.html">
            
                    
                    数据结构高级内容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="函数.html">
            
                <a href="函数.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.7" data-path="函数式编程.html">
            
                <a href="函数式编程.html">
            
                    
                    函数式编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="面向对象编程.html">
            
                <a href="面向对象编程.html">
            
                    
                    面向对象编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="类的特殊方法.html">
            
                <a href="类的特殊方法.html">
            
                    
                    类的特殊方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="异常处理.html">
            
                <a href="异常处理.html">
            
                    
                    异常处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="IO编程.html">
            
                <a href="IO编程.html">
            
                    
                    IO编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="模块.html">
            
                <a href="模块.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="标准库.html">
            
                <a href="标准库.html">
            
                    
                    标准库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="测试.html">
            
                <a href="测试.html">
            
                    
                    测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="调试.html">
            
                <a href="调试.html">
            
                    
                    调试
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >函数式编程</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;">&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;</h1>
<hr>
<blockquote>
<p>Python &#x5BF9;&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#x63D0;&#x4F9B;&#x90E8;&#x5206;&#x652F;&#x6301;&#x3002;&#x7531;&#x4E8E; Python &#x5141;&#x8BB8;&#x4F7F;&#x7528;&#x53D8;&#x91CF;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;Python &#x4E0D;&#x662F;&#x7EAF;&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x3002;</p>
</blockquote>
<p>&#x4EE5;&#x51FD;&#x6570;&#x4E3A;&#x5355;&#x5143;&#x628A;&#x590D;&#x6742;&#x4EFB;&#x52A1;&#x5206;&#x89E3;&#xFF0C;&#x8FD9;&#x79CD;&#x5206;&#x89E3;&#x79F0;&#x4E4B;&#x4E3A;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7F16;&#x7A0B;&#x3002;</p>
<p>&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#xFF08;Functional Programming&#xFF09;&#x867D;&#x7136;&#x4E5F;&#x53EF;&#x4EE5;&#x5F52;&#x7ED3;&#x5230;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7684;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#xFF0C;&#x4F46;&#x5176;&#x601D;&#x60F3;&#x66F4;&#x63A5;&#x8FD1;&#x6570;&#x5B66;&#x8BA1;&#x7B97;&#x3002;&#x5B83;&#x662F;&#x4E00;&#x79CD;&#x62BD;&#x8C61;&#x7A0B;&#x5EA6;&#x5F88;&#x9AD8;&#x7684;&#x7F16;&#x7A0B;&#x8303;&#x5F0F;&#xFF0C;&#x5141;&#x8BB8;&#x628A;&#x51FD;&#x6570;&#x672C;&#x8EAB;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x4F20;&#x5165;&#x53E6;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x8FD8;&#x5141;&#x8BB8;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x3002;</p>
<p>&#x7EAF;&#x7CB9;&#x7684;&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x7F16;&#x5199;&#x7684;&#x51FD;&#x6570;&#x6CA1;&#x6709;&#x53D8;&#x91CF;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x4EFB;&#x610F;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x53EA;&#x8981;&#x8F93;&#x5165;&#x662F;&#x786E;&#x5B9A;&#x7684;&#xFF0C;&#x8F93;&#x51FA;&#x5C31;&#x662F;&#x786E;&#x5B9A;&#x7684;&#xFF0C;&#x8FD9;&#x79CD;&#x7EAF;&#x51FD;&#x6570;&#x6211;&#x4EEC;&#x79F0;&#x4E4B;&#x4E3A;&#x6CA1;&#x6709;&#x526F;&#x4F5C;&#x7528;&#x3002;<br>&#x800C;&#x5141;&#x8BB8;&#x4F7F;&#x7528;&#x53D8;&#x91CF;&#x7684;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x8BED;&#x8A00;&#xFF0C;&#x7531;&#x4E8E;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x7684;&#x53D8;&#x91CF;&#x72B6;&#x6001;&#x4E0D;&#x786E;&#x5B9A;&#xFF0C;&#x540C;&#x6837;&#x7684;&#x8F93;&#x5165;&#xFF0C;&#x53EF;&#x80FD;&#x5F97;&#x5230;&#x4E0D;&#x540C;&#x7684;&#x8F93;&#x51FA;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x8FD9;&#x79CD;&#x51FD;&#x6570;&#x662F;&#x6709;&#x526F;&#x4F5C;&#x7528;&#x7684;&#x3002;</p>
<h2 id="&#x9AD8;&#x9636;&#x51FD;&#x6570;">&#x9AD8;&#x9636;&#x51FD;&#x6570;</h2>
<p>&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x5C31;&#x53EF;&#x4EE5;&#x63A5;&#x6536;&#x53E6;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#xFF0C;&#x8FD9;&#x79CD;&#x51FD;&#x6570;&#x5C31;&#x79F0;&#x4E4B;&#x4E3A;&#x9AD8;&#x9636;&#x51FD;&#x6570;&#xFF08;Higher-order function&#xFF09;&#x3002;&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#x5C31;&#x662F;&#x6307;&#x8FD9;&#x79CD;&#x9AD8;&#x5EA6;&#x62BD;&#x8C61;&#x7684;&#x7F16;&#x7A0B;&#x8303;&#x5F0F;&#x3002;</p>
<h2 id="map">map</h2>
<p>&#x51FD;&#x6570;&#x539F;&#x578B;&#xFF1A;<code>map(func, *iterables) --&gt; map object</code>  </p>
<p>map()&#x51FD;&#x6570;&#x63A5;&#x6536;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x4E00;&#x4E2A;&#x662F;&#x51FD;&#x6570;func&#xFF0C;&#x53E6;&#x4E00;&#x4E2A;&#x662F;&#x53EF;&#x53D8;&#x53C2;&#x6570;&#xFF08;iterables&#x662F;&#x4E00;&#x4E2A;tuple&#xFF09;&#xFF0C;&#x53EF;&#x4EE5;&#x662F;1&#x4E2A;&#x6216;&#x591A;&#x4E2A;Iterable&#x5BF9;&#x8C61;&#xFF08;&#x6570;&#x76EE;&#x5BF9;&#x5E94;func&#x7684;&#x5F62;&#x53C2;&#x6570;&#xFF09;&#x3002;  </p>
<p>map &#x5C06;&#x5E8F;&#x5217;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x4F9D;&#x6B21;&#x4F20;&#x5165;&#x5230;&#x51FD;&#x6570;&#xFF0C;&#x5E76;&#x751F;&#x6210;&#x4E00;&#x4E2A;map&#x5BF9;&#x8C61;&#xFF08;&#x662F;&#x4E00;&#x4E2A;Iterator&#x5BF9;&#x8C61;&#xFF0C;&#x4E00;&#x4E2A;&#x60F0;&#x6027;&#x5E8F;&#x5217;&#xFF09;&#x3002;
&#x8BA1;&#x7B97;&#x7B49;&#x4EF7;&#x4E8E;&#xFF1A;</p>
<pre><code>map(f, [x1,x2,...,xn], [y1,y2,...,yn], ...) 
                    =&gt; 
[f(x1,y1,...), f(x2,y2,...), ..., f(xn,yn,...)]
</code></pre><p>&#x4E3E;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x)</span>:</span>
<span class="hljs-meta">... </span>  <span class="hljs-keyword">return</span> x * x
...
<span class="hljs-meta">&gt;&gt;&gt; </span>r = map(f, [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>list(r)
[<span class="hljs-number">1</span>, <span class="hljs-number">4</span>, <span class="hljs-number">9</span>, <span class="hljs-number">16</span>, <span class="hljs-number">25</span>, <span class="hljs-number">36</span>, <span class="hljs-number">49</span>, <span class="hljs-number">64</span>, <span class="hljs-number">81</span>]
</code></pre>
<p>&#x6A21;&#x62DF;map&#x7684;&#x5B9E;&#x73B0;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">mymap</span><span class="hljs-params">(func, *iterables)</span>:</span>
    res = []
    <span class="hljs-keyword">for</span> args <span class="hljs-keyword">in</span> zip(*iterables):
        res.append(func(*args))
    <span class="hljs-keyword">return</span> res
</code></pre>
<p>&#x9A8C;&#x8BC1;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">sum</span><span class="hljs-params">(x,y)</span>:</span>
    <span class="hljs-keyword">return</span> x+y
print(mymap(sum, [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>], [<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>]))    <span class="hljs-comment">#&#x8F93;&#x51FA;&#xFF1A; [5,7,9]</span>
</code></pre>
<p>&#x5206;&#x6790;&#xFF1A;<br>1&#xFF09;&#x6253;&#x5305;&#x53C2;&#x6570;&#xFF0C;&#x6784;&#x6210;&#x5143;&#x7EC4;iterables&#x4E3A;([1,2,3], [4,5,6])<br>2&#xFF09;<code>*iterables</code>&#x89E3;&#x5305;&#x53C2;&#x6570;&#x4F20;&#x5165;zip([1,2,3], [4,5,6])<br>3&#xFF09;&#x904D;&#x5386;&#x4F1A;&#x5F97;&#x5230;&#x4E00;&#x7CFB;&#x5217;&#x7684;tunple&#x5E76;&#x4EA4;&#x7ED9;args&#xFF0C;&#x5373;(1,2) (2,5)  (3,6)<br>4&#xFF09;<code>*args</code>&#x89E3;&#x5305;&#x5143;&#x7EC4;&#x5E76;&#x4F20;&#x5165;func&#xFF0C;&#x5373;func(1,2) func(2,5)  func(3,6)  </p>
<h2 id="reduce">reduce</h2>
<p>&#x9700;&#x8981;&#x5BFC;&#x5165;&#xFF1A;<code>from functools import reduce</code><br>&#x51FD;&#x6570;&#x539F;&#x578B;&#xFF1A;<code>reduce(func, sequence) --&gt; value</code>  </p>
<p>reduce()&#x51FD;&#x6570;&#x63A5;&#x6536;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x4E00;&#x4E2A;&#x662F;&#x51FD;&#x6570;func&#xFF0C;&#x53E6;&#x4E00;&#x4E2A;&#x662F;&#x5E8F;&#x5217;&#x3002;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#x4E3A;&#x51FD;&#x6570;&#x8BA1;&#x7B97;&#x503C;&#x3002;<br>reduce &#x628A;&#x7ED3;&#x679C;&#x7EE7;&#x7EED;&#x548C;&#x5E8F;&#x5217;&#x7684;&#x4E0B;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x505A;&#x7D2F;&#x79EF;&#x8BA1;&#x7B97;.<br>&#x8BA1;&#x7B97;&#x7B49;&#x4EF7;&#x4E8E;&#xFF1A;  </p>
<pre><code>reduce(f, [x1, x2, x3, x4]) = f(f(f(x1, x2), x3), x4)
</code></pre><h2 id="filter">filter</h2>
<p>&#x51FD;&#x6570;&#x539F;&#x578B;&#xFF1A;<code>filter(function, iterable) --&gt; filter object</code>  </p>
<p>filter&#x628A;&#x4F20;&#x5165;&#x7684;&#x51FD;&#x6570;&#x4F9D;&#x6B21;&#x4F5C;&#x7528;&#x4E8E;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x7136;&#x540E;&#x6839;&#x636E;&#x8FD4;&#x56DE;&#x503C;&#x662F; True &#x8FD8;&#x662F; False &#x51B3;&#x5B9A;&#x4FDD;&#x7559;&#x8FD8;&#x662F;&#x4E22;&#x5F03;&#x8BE5;&#x5143;&#x7D20;&#x3002;<br>&#x7ED3;&#x679C;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;filter&#x5BF9;&#x8C61;&#xFF08;&#x662F;&#x4E00;&#x4E2A;Iterator&#x5BF9;&#x8C61;&#xFF0C;&#x4E00;&#x4E2A;&#x60F0;&#x6027;&#x5E8F;&#x5217;&#xFF09;&#x3002;  </p>
<p>&#x4E3E;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_odd</span><span class="hljs-params">(n)</span>:</span>
    <span class="hljs-keyword">return</span> n % <span class="hljs-number">2</span> == <span class="hljs-number">1</span>
list(filter(is_odd, [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">15</span>]))           <span class="hljs-comment"># &#x7ED3;&#x679C;: [1, 5, 9, 15]</span>
</code></pre>
<p>&#x6CE8;&#x610F;&#x5230; <code>filter()</code>&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x4E00;&#x4E2A; Iterator&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x60F0;&#x6027;&#x5E8F;&#x5217;&#xFF0C;&#x6240;&#x4EE5;&#x8981;&#x5F3A;&#x8FEB; <code>filter()</code>&#x5B8C;&#x6210;&#x8BA1;&#x7B97;&#x7ED3;&#x679C;&#xFF0C;&#x9700;&#x8981;&#x7528; <code>list()</code>&#x51FD;&#x6570;&#x83B7;&#x5F97;&#x6240;&#x6709;&#x7ED3;&#x679C;&#x5E76;&#x8FD4;&#x56DE; list&#x3002;  </p>
<blockquote>
<p>[&#x5C0F;&#x7ED3;] filter()&#x7684;&#x4F5C;&#x7528;&#x662F;&#x4ECE;&#x4E00;&#x4E2A;&#x5E8F;&#x5217;&#x4E2D;&#x7B5B;&#x51FA;&#x7B26;&#x5408;&#x6761;&#x4EF6;&#x7684;&#x5143;&#x7D20;&#x3002;&#x7531;&#x4E8E; filter()&#x4F7F;&#x7528;&#x4E86;&#x60F0;&#x6027;&#x8BA1;&#x7B97;&#xFF0C;&#x6240;&#x4EE5;&#x53EA;&#x6709;&#x5728;&#x53D6; filter()&#x7ED3;&#x679C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x624D;&#x4F1A;&#x771F;&#x6B63;&#x7B5B;&#x9009;&#x5E76;&#x6BCF;&#x6B21;&#x8FD4;&#x56DE;&#x4E0B;&#x4E00;&#x4E2A;&#x7B5B;&#x51FA;&#x7684;&#x5143;&#x7D20;&#x3002;</p>
</blockquote>
<h2 id="sorted">sorted</h2>
<p>&#x51FD;&#x6570;&#x539F;&#x578B;&#xFF1A;<code>sorted(iterable, key=None, reverse=False) --&gt; new sorted list</code>  </p>
<p>&#x53EF;&#x4EE5;&#x5BF9;&#x4E00;&#x4E2A;iterable&#x5BF9;&#x8C61;&#x6392;&#x5E8F;&#xFF0C;&#x5E76;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;list&#x5BF9;&#x8C61;&#x3002;<br>key &#x6307;&#x5B9A;&#x7684;&#x51FD;&#x6570;&#x5C06;&#x4F5C;&#x7528;&#x4E8E; iterable &#x7684;&#x6BCF;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x4E0A;&#xFF0C;&#x5E76;&#x6839;&#x636E; key &#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x7ED3;&#x679C;&#x8FDB;&#x884C;&#x6392;&#x5E8F;&#xFF08;&#x6392;&#x5E8F;&#x9075;&#x5FAA;&#x4E00;&#x822C;&#x7684;&#x6BD4;&#x8F83;&#x539F;&#x5219;&#xFF0C;&#x6570;&#x5B57;&#x76F4;&#x63A5;&#x6BD4;&#x8F83;&#xFF0C;&#x5B57;&#x6BCD;&#x6BD4;&#x8F83;ASCII&#x503C;&#x7B49;&#x7B49;&#xFF09;&#x3002;<br>reverse&#x8868;&#x793A;&#x662F;&#x5426;&#x9700;&#x8981;&#x5C06;&#x6392;&#x5E8F;&#x7ED3;&#x679C;&#x5012;&#x8FC7;&#x6765;&#x3002;  </p>
<pre><code class="lang-python"><span class="hljs-meta">&gt;&gt;&gt; </span>sorted([<span class="hljs-string">&apos;bob&apos;</span>, <span class="hljs-string">&apos;about&apos;</span>, <span class="hljs-string">&apos;Zoo&apos;</span>, <span class="hljs-string">&apos;Credit&apos;</span>], key=str.lower,reverse=<span class="hljs-keyword">True</span>)  
[<span class="hljs-string">&apos;Zoo&apos;</span>, <span class="hljs-string">&apos;Credit&apos;</span>, <span class="hljs-string">&apos;bob&apos;</span>, <span class="hljs-string">&apos;about&apos;</span>]
</code></pre>
<p>&#x8FD9;&#x91CC;&#xFF0C;key&#x6307;&#x5411;&#x7684;&#x51FD;&#x6570;&#x5C06;&#x5143;&#x7D20;&#x53D8;&#x6210;&#x5C0F;&#x5199;&#x8FD4;&#x56DE;&#xFF0C;&#x7136;&#x540E;sorted&#x5BF9;&#x5C0F;&#x5199;&#x7684;&#x7ED3;&#x679C;&#x8FDB;&#x884C;&#x6392;&#x5E8F;&#x3002;  </p>
<h2 id="&#x95ED;&#x5305;">&#x95ED;&#x5305;</h2>
<p>&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x548C;&#x5B83;&#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x5408;&#x5728;&#x4E00;&#x8D77;&#xFF0C;&#x5C31;&#x6784;&#x6210;&#x4E86;&#x4E00;&#x4E2A;&#x95ED;&#x5305;&#x3002;&#x5728;Python&#x4E2D;&#xFF0C;&#x6240;&#x8C13;&#x95ED;&#x5305;&#x662F;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x6709;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D6;&#x503C;&#x7684;&#x51FD;&#x6570;&#x5BF9;&#x8C61;&#x3002;
&#x6362;&#x53E5;&#x8BDD;&#x8BF4;&#xFF0C;&#x95ED;&#x5305;&#x662F;&#x5185;&#x5C42;&#x51FD;&#x6570;&#x5F15;&#x7528;&#x4E86;&#x5916;&#x5C42;&#x51FD;&#x6570;&#x7684;&#x53D8;&#x91CF;&#xFF08;&#x5305;&#x62EC;&#x5B83;&#x7684;&#x53C2;&#x6570;&#xFF09;&#xFF0C;&#x7136;&#x540E;&#x8FD4;&#x56DE;&#x5185;&#x5C42;&#x51FD;&#x6570;&#x7684;&#x60C5;&#x51B5;&#x3002;<br>&#x5F53;&#x4E00;&#x4E2A;&#x51FD;&#x6570;A&#x5185;&#x90E8;&#x5B9A;&#x4E49;&#x4E86;&#x51FD;&#x6570;B&#xFF0C;&#x51FD;&#x6570;B&#x5F15;&#x7528;&#x4E86;A&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x5F53;A&#x5C06;&#x51FD;&#x6570;B&#x4F5C;&#x4E3A;&#x8FD4;&#x56DE;&#x503C;&#x65F6;&#xFF0C;&#x76F8;&#x5173;&#x53C2;&#x6570;&#x548C;&#x53D8;&#x91CF;&#x90FD;&#x4FDD;&#x5B58;&#x5728;&#x8FD4;&#x56DE;&#x7684;&#x51FD;&#x6570;&#x4E2D;&#xFF0C;&#x8FD9;&#x79CD;&#x79F0;&#x4E3A;&#x201C;&#x95ED;&#x5305;&#x201D;&#x3002;  </p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">A</span><span class="hljs-params">(x)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">B</span><span class="hljs-params">(y)</span>:</span>
        xx = x + y
        <span class="hljs-keyword">return</span> xx
    <span class="hljs-keyword">return</span> B   <span class="hljs-comment">#return a function object</span>
</code></pre>
<p>&#x5F53;&#x6211;&#x4EEC;&#x8C03;&#x7528; A()&#x65F6;&#xFF0C;&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x5BF9;&#x8C61;&#xFF0C;&#x8C03;&#x7528;&#x51FD;&#x6570;f&#x65F6;&#xFF0C;&#x624D;&#x771F;&#x6B63;&#x8BA1;&#x7B97;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-meta">&gt;&gt;&gt; </span>f = A(<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>f
&lt;function A.&lt;locals&gt;.B at <span class="hljs-number">0x0000000000B57268</span>&gt;
<span class="hljs-meta">&gt;&gt;&gt; </span>f(<span class="hljs-number">2</span>)
<span class="hljs-number">3</span>
</code></pre>
<p>&#x5F53;&#x6211;&#x4EEC;&#x8C03;&#x7528;A&#x65F6;&#xFF0C;&#x6BCF;&#x6B21;&#x8C03;&#x7528;&#x90FD;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x51FD;&#x6570;&#x5BF9;&#x8C61;&#xFF0C;&#x5373;&#x4F7F;&#x4F20;&#x5165;&#x76F8;&#x540C;&#x7684;&#x53C2;&#x6570;:</p>
<pre><code class="lang-python"><span class="hljs-meta">&gt;&gt;&gt; </span>f1 = A(<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>f2 = A(<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>f1==f2    <span class="hljs-comment">#f1()&#x548C; f2()&#x7684;&#x8C03;&#x7528;&#x7ED3;&#x679C;&#x4E92;&#x4E0D;&#x5F71;&#x54CD;</span>
<span class="hljs-keyword">False</span>
</code></pre>
<blockquote>
<p>[&#x6CE8;&#x610F;] &#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x65F6;&#xFF0C;&#x7262;&#x8BB0;&#x8BE5;&#x51FD;&#x6570;&#x5E76;&#x672A;&#x7ACB;&#x523B;&#x6267;&#x884C;&#xFF0C;&#x800C;&#x662F;&#x76F4;&#x5230;&#x8C03;&#x7528;&#x65F6;&#x624D;&#x6267;&#x884C;&#xFF1B;&#x8FD4;&#x56DE;&#x51FD;&#x6570;&#x4E2D;&#x4E0D;&#x8981;&#x5F15;&#x7528;&#x4EFB;&#x4F55;&#x53EF;&#x80FD;&#x4F1A;&#x53D8;&#x5316;&#x7684;&#x53D8;&#x91CF;&#xFF08;&#x4EFB;&#x4F55;&#x5FAA;&#x73AF;&#x53D8;&#x91CF;&#xFF0C; &#x6216;&#x8005;&#x540E;&#x7EED;&#x4F1A;&#x53D1;&#x751F;&#x53D8;&#x5316;&#x7684;&#x53D8;&#x91CF;&#x3002;&#xFF09;&#x3002;</p>
</blockquote>
<h2 id="&#x88C5;&#x9970;&#x5668;">&#x88C5;&#x9970;&#x5668;</h2>
<p>&#x5047;&#x8BBE;&#x6211;&#x4EEC;&#x8981;&#x589E;&#x5F3A; now()&#x51FD;&#x6570;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x6BD4;&#x5982;&#xFF0C;&#x5728;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x524D;&#x540E;&#x81EA;&#x52A8;&#x6253;&#x5370;&#x65E5;&#x5FD7;&#xFF0C;&#x4F46;&#x53C8;&#x4E0D;&#x5E0C;&#x671B;&#x4FEE;&#x6539; now()&#x51FD;&#x6570;&#x7684;&#x5B9A;&#x4E49;&#xFF0C;&#x8FD9;&#x79CD;&#x5728;&#x4EE3;&#x7801;&#x8FD0;&#x884C;&#x671F;&#x95F4;&#x52A8;&#x6001;&#x589E;&#x52A0;&#x529F;&#x80FD;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x79F0;&#x4E4B;&#x4E3A;&#x201C;&#x88C5;&#x9970;&#x5668;&#x201D;&#xFF08; Decorator&#xFF09;&#x3002;  </p>
<p>&#x672C;&#x8D28;&#x4E0A;&#xFF0C; decorator &#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x8FD4;&#x56DE;&#x51FD;&#x6570;&#x7684;&#x9AD8;&#x9636;&#x51FD;&#x6570;&#x3002;<br>&#x4E3E;&#x4F8B;&#xFF1A;  </p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">log</span><span class="hljs-params">(func)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">wrapper</span><span class="hljs-params">(*args, **kw)</span>:</span>
        print(<span class="hljs-string">&apos;begin call&apos;</span>)
        ret = func(*args, **kw)
        print(<span class="hljs-string">&apos;end call&apos;</span>)
        <span class="hljs-keyword">return</span> ret
    <span class="hljs-keyword">return</span> wrapper
<span class="hljs-comment">#&#x5206;&#x6790;&#xFF1A;now = log(now) = wrapper</span>
<span class="hljs-meta">@log</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">now</span><span class="hljs-params">()</span>:</span>
    print(<span class="hljs-string">&apos;hello...&apos;</span>)
now()
print(now.__name__)    <span class="hljs-comment">#&#x8F93;&#x51FA;wrapper</span>
</code></pre>
<p>&#x5206;&#x6790;&#xFF1A;<br>&#x628A;@log &#x653E;&#x5230; now()&#x51FD;&#x6570;&#x7684;&#x5B9A;&#x4E49;&#x5904;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x6267;&#x884C;&#x4E86;&#x8BED;&#x53E5;&#xFF1A;  </p>
<pre><code class="lang-python">now = log(now)
</code></pre>
<p>&#x7531;&#x4E8E; log()&#x662F;&#x4E00;&#x4E2A; decorator&#xFF0C;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x6240;&#x4EE5;&#xFF0C;&#x539F;&#x6765;&#x7684; now()&#x51FD;&#x6570;&#x4ECD;&#x7136;&#x5B58;&#x5728;&#xFF0C;&#x53EA;&#x662F;&#x73B0;&#x5728;&#x540C;&#x540D;&#x7684; now &#x53D8;&#x91CF;&#x6307;&#x5411;&#x4E86;&#x65B0;&#x7684;&#x51FD;&#x6570;&#xFF08;&#x540C;&#x540D;&#x7684;&#x53D8;&#x91CF;&#x4F18;&#x5148;&#x88AB;&#x4F7F;&#x7528;&#xFF09;&#xFF0C;&#x4E8E;&#x662F;&#x8C03;&#x7528; now()&#x5C06;&#x6267;&#x884C;&#x65B0;&#x51FD;&#x6570;&#xFF0C;&#x5373;&#x5728; log()&#x51FD;&#x6570;&#x4E2D;&#x8FD4;&#x56DE;&#x7684; wrapper()&#x51FD;&#x6570;&#x3002;  </p>
<p>&#x5982;&#x679C; decorator &#x672C;&#x8EAB;&#x9700;&#x8981;&#x4F20;&#x5165;&#x53C2;&#x6570;&#xFF0C;&#x90A3;&#x5C31;&#x9700;&#x8981;&#x7F16;&#x5199;&#x4E00;&#x4E2A;&#x8FD4;&#x56DE; decorator &#x7684;&#x9AD8;&#x9636;&#x51FD;&#x6570;&#xFF08;&#x5D4C;&#x5957;&#x4E00;&#x5C42;decorator&#xFF09;&#x3002;<br>&#x4E3E;&#x4F8B;&#xFF1A;  </p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">log</span><span class="hljs-params">(text)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">decorator</span><span class="hljs-params">(func)</span>:</span>
        <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">wrapper</span><span class="hljs-params">(*args, **kw)</span>:</span>
            print(text)
            print(<span class="hljs-string">&apos;begin call&apos;</span>)
            ret = func(*args, **kw)
            print(<span class="hljs-string">&apos;end call&apos;</span>)
            <span class="hljs-keyword">return</span> ret
        <span class="hljs-keyword">return</span> wrapper
    <span class="hljs-keyword">return</span> decorator
<span class="hljs-comment">#&#x5206;&#x6790;&#xFF1A;now = log(&apos;erick&apos;)(now) = decorator(now) = wrapper</span>
<span class="hljs-meta">@log(&apos;erick&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">now</span><span class="hljs-params">()</span>:</span>
    print(<span class="hljs-string">&apos;hello...&apos;</span>)
now()
print(now.__name__)  <span class="hljs-comment">#&#x8F93;&#x51FA;wrapper</span>
</code></pre>
<p>&#x4EE5;&#x4E0A;&#x4E24;&#x79CD; decorator &#x7684;&#x5B9A;&#x4E49;&#x90FD;&#x6CA1;&#x6709;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x8FD8;&#x5DEE;&#x6700;&#x540E;&#x4E00;&#x6B65;&#x3002;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x8BB2;&#x4E86;&#x51FD;&#x6570;&#x4E5F;&#x662F;&#x5BF9;&#x8C61;&#xFF0C;&#x5B83;&#x6709;<code>__name__</code>&#x7B49;&#x5C5E;&#x6027;&#xFF0C;&#x4F46;&#x4F60;&#x53BB;&#x770B;&#x7ECF;&#x8FC7; decorator &#x88C5;&#x9970;&#x4E4B;&#x540E;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5B83;&#x4EEC;&#x7684;<code>__name__</code>&#x5DF2;&#x7ECF;&#x4ECE;&#x539F;&#x6765;&#x7684;&apos;now&apos;&#x53D8;&#x6210;&#x4E86;&apos;wrapper&apos;&#x3002;&#x6240;&#x4EE5;&#xFF0C;&#x9700;&#x8981;&#x628A;&#x539F;&#x59CB;&#x51FD;&#x6570;&#x7684;<code>__name__</code>&#x7B49;&#x5C5E;&#x6027;&#x590D;&#x5236;&#x5230; wrapper()&#x51FD;&#x6570;&#x4E2D;&#xFF0C;&#x5426;&#x5219;&#xFF0C;&#x6709;&#x4E9B;&#x4F9D;&#x8D56;&#x51FD;&#x6570;&#x7B7E;&#x540D;&#x7684;&#x4EE3;&#x7801;&#x6267;&#x884C;&#x5C31;&#x4F1A;&#x51FA;&#x9519;&#x3002;  </p>
<p>&#x4E0D;&#x9700;&#x8981;&#x7F16;&#x5199; <code>wrapper.__name__ = func.__name__</code>&#x8FD9;&#x6837;&#x7684;&#x4EE3;&#x7801;&#xFF0C; Python &#x5185;&#x7F6E;&#x7684; <code>functools.wraps</code> &#x5C31;&#x662F;&#x5E72;&#x8FD9;&#x4E2A;&#x4E8B;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#xFF0C;&#x4E00;&#x4E2A;&#x5B8C;&#x6574;&#x7684; decorator &#x7684;&#x5199;&#x6CD5;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> functools
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">log</span><span class="hljs-params">(func)</span>:</span>
<span class="hljs-meta">    @functools.wraps(func)   #&#x589E;&#x52A0;&#x8FD9;&#x4E00;&#x884C;</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">wrapper</span><span class="hljs-params">(*args, **kw)</span>:</span>
        print(<span class="hljs-string">&apos;begin call&apos;</span>)
        ret = func(*args, **kw)
        print(<span class="hljs-string">&apos;end call&apos;</span>)
        <span class="hljs-keyword">return</span> ret
    <span class="hljs-keyword">return</span> wrapper
</code></pre>
<h2 id="&#x504F;&#x51FD;&#x6570;">&#x504F;&#x51FD;&#x6570;</h2>
<p>&#x9700;&#x8981;&#x5BFC;&#x5165;&#xFF1A;<code>from functools import partial</code>  </p>
<p>&#x504F;&#x51FD;&#x6570;&#x662F;&#x67D0;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x5E26;&#x6709;&#x56FA;&#x5B9A;&#x53C2;&#x6570;&#x7684;&#x5B9E;&#x73B0;&#x3002;<br>partial &#x7684;&#x4F5C;&#x7528;&#x5C31;&#x662F;&#xFF0C;&#x628A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x7684;&#x67D0;&#x4E9B;&#x53C2;&#x6570;&#x7ED9;&#x56FA;&#x5B9A;&#x4F4F;&#xFF08;&#x4E5F;&#x5C31;&#x662F;&#x8BBE;&#x7F6E;&#x9ED8;&#x8BA4;&#x503C;&#xFF09;&#xFF0C;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x8C03;&#x7528;&#x8FD9;&#x4E2A;&#x65B0;&#x51FD;&#x6570;&#x4F1A;&#x66F4;&#x7B80;&#x5355;&#x3002;<br>&#x53C2;&#x6570;&#x4F4D;&#x7F6E;&#x95EE;&#x9898;&#xFF1A;&#x5BF9;&#x4E8E;&#x65E0;&#x5173;&#x952E;&#x5B57;&#x53C2;&#x6570;&#xFF0C;&#x4F4D;&#x7F6E;&#x5728;&#x6700;&#x5DE6;&#x8FB9;&#xFF1B;&#x5BF9;&#x4E8E;&#x5173;&#x952E;&#x5B57;&#x53C2;&#x6570;&#xFF0C;&#x8C03;&#x7528;&#x65F6;&#x4F1A;&#x7ED9;&#x51FA;&#x5F62;&#x53C2;&#x540D;&#xFF0C;&#x6240;&#x4EE5;&#x4F4D;&#x7F6E;&#x4E0D;&#x7528;&#x7BA1;&#x3002;  </p>
<p>&#x4F8B;1&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">sum</span><span class="hljs-params">(x,y,z)</span>:</span>
    print(x,y,z)
    <span class="hljs-keyword">return</span> x+y+z
newsum = partial(sum, <span class="hljs-number">1</span>,<span class="hljs-number">2</span>)    <span class="hljs-comment">#newsum(z)&#x7B49;&#x4EF7;&#x4E8E;sum(1,2,z)</span>
print(newsum(<span class="hljs-number">3</span>))
</code></pre>
<p>&#x4F8B;2&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">mymod</span><span class="hljs-params">(x, y=<span class="hljs-number">2</span>)</span>:</span>
    <span class="hljs-keyword">return</span> x % y
newmymod = partial(mymod, y=<span class="hljs-number">8</span>)  <span class="hljs-comment">#newmymod(x)&#x7B49;&#x4EF7;&#x4E8E;mymod(x, y=8)</span>
print(newmymod(<span class="hljs-number">9</span>))
</code></pre>
<p>&#x6A21;&#x62DF;&#x5B9E;&#x73B0;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">mypartial</span><span class="hljs-params">(func, *args, **keywords)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">newfunc</span><span class="hljs-params">(*fargs, **fkeywords)</span>:</span>
        newkeywords = keywords.copy()
        newkeywords.update(fkeywords)   <span class="hljs-comment">#&#x5408;&#x5E76;&#x5B57;&#x5178;</span>
        <span class="hljs-keyword">return</span> func(*(args + fargs), **newkeywords)   <span class="hljs-comment">#&#x53C2;&#x6570;&#x5408;&#x5E76;&#x540E;&#x4F20;&#x7ED9;func&#xFF0C;&#x6CE8;&#x610F;args&#x5728;&#x6700;&#x5DE6;&#x8FB9;</span>
    <span class="hljs-keyword">return</span> newfunc  <span class="hljs-comment">#&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x95ED;&#x5305;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="函数.html" class="navigation navigation-prev " aria-label="Previous page: 函数">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="面向对象编程.html" class="navigation navigation-next " aria-label="Next page: 面向对象编程">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"函数式编程","level":"1.7","depth":1,"next":{"title":"面向对象编程","level":"1.8","depth":1,"path":"面向对象编程.md","ref":"面向对象编程.md","articles":[]},"previous":{"title":"函数","level":"1.6","depth":1,"path":"函数.md","ref":"函数.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"函数式编程.md","mtime":"2017-08-23T14:54:57.257Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-08-27T04:11:18.522Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

